Skip to content

Allow proc_mesh.stop() after actor_mesh.stop() #877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

thomasywang
Copy link
Contributor

Summary:
Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Differential Revision: D80269385

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 14, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D80269385

thomasywang added a commit to thomasywang/monarch-1 that referenced this pull request Aug 15, 2025
Summary:

Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Reviewed By: ahmadsharif1

Differential Revision: D80269385
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D80269385

thomasywang added a commit to thomasywang/monarch-1 that referenced this pull request Aug 15, 2025
Summary:
Pull Request resolved: meta-pytorch#877

Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Reviewed By: ahmadsharif1

Differential Revision: D80269385
thomasywang added a commit to thomasywang/monarch-1 that referenced this pull request Aug 16, 2025
Summary:

Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Reviewed By: ahmadsharif1

Differential Revision: D80269385
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D80269385

thomasywang added a commit to thomasywang/monarch-1 that referenced this pull request Aug 16, 2025
Summary:
Pull Request resolved: meta-pytorch#877

Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Reviewed By: ahmadsharif1

Differential Revision: D80269385
thomasywang added a commit to thomasywang/monarch-1 that referenced this pull request Aug 18, 2025
Summary:

Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Reviewed By: ahmadsharif1

Differential Revision: D80269385
Summary:
Pull Request resolved: meta-pytorch#877

Currently calling proc_mesh.stop() will fail if an actor_mesh spawned on this proc_mesh has been stopped.

This is because the python-binding wrapper for ProcMesh (TrackedProcMesh) holds onto a map of SharedCells containing each RootActorMesh spawned on it. When an PythonActorMesh is stopped, the RootActorMesh is dropped, but does not update the state of the TrackedProcMesh to remove this. When a ProcMesh is stopped, it will attempt to discard every SharedCell containing it's RootActorMeshes, but will return an error if any RootActorMesh has been dropped (The error we are seeing)

We can make it such that stopping the PythonActorMesh will update the state of the TrackedProcMesh, but this would involve plumbing through references of TrackedProcMesh and related state to PythonActorMesh

A simpler solution, it to simply allow the TrackedProcMesh to discard the errors related to attempting to discard a SharedCell where the RootActorMesh has already been dropped

Reviewed By: ahmadsharif1

Differential Revision: D80269385
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D80269385

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in cac2e47.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants